<?php 
	require 'Model.php';
	class indexModel extends Model{
		function __Construct(){
			parent::__Construct();
		}

		//获取活动照片
		function getactivityphoto(){
			$sql="select activity,acphoto from society";
			$photolist = $this->conn->query($sql);
			return $photolist;
		}

		//获取活动名称和意义
		function getsignifi(){
			$sql="select activity,dename,signifi,time from society";
			$sgnifi = $this->conn->query($sql);
			return $sgnifi;
		}

		//获取部门信息
		function getdename(){
			$sql="select dename,duty,dephoto,minister from des";
			$denamelist = $this->conn->query($sql);
			return $denamelist;
		}

		//个人信息
		function getuserlist(){
			$sql="select name,photo,department from departmentusers";
			$list = $this->conn->query($sql);
			return $list;
		}

		//获取合作相关信息
		function getcooperate(){
			$sql="select coproject,phone,cointro from cooperate";
			$co = $this->conn->query($sql);
			return $co;
		}

		function fetch_one($sql,$result_type=MYSQL_ASSOC)
		{
		    $result=mysql_query($sql);
		    if ($result && mysql_num_rows($result)>0)
		    {
		        return mysql_fetch_array($result,$result_type);
		    }
		    else
		    {
		        return false;
		    }
		}

		function getvideoshow($id){
			$sql='select videos.*,comments.* from videos left join comments on videos.vid=comments.vid where videos.vid='.$id.'';
   			$show=$this->fetch_one($sql);
   			return $show;
		}
	}

?>